/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Figuras;

/**
 *
 * @author Gustavo Canul Poot
 */
public class Paralelogramo extends Cuadrilatero{

    public Paralelogramo(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
        super(x1, y1, x2, y2, x3, y3, x4, y4);
    }

    @Override
    public double area() {
        
        //Distancia extra
        //Distancia entre (X4,Y4)(X4,Y1)
       double c = this.getX4() - this.getX4();
       double d = this.getY4()- this.getY1();
       double alt = Math.sqrt(Math.pow(c,2)+Math.pow(d, 2));
        
        if(this.getDist() == this.getDist6() && this.getDist4() == this.getDist2() )
        {
        return alt*getDist();    
        }
        
        else
        {
            return 0.0;
        }
        
    }
}